package com.tsj.mvp.demo3;

/**
 * 专门复制交互（中介，关联view和model）
 * */
public class LoginPresenter3 {

    public LoginModel3 loginModel;
    public LoginView3 loginView;

    public LoginPresenter3(){
        loginModel = new LoginModel3();
    }

    public void login(String username,String password){
        loginModel.login(username, password, new LoginModel3.CallBack() {
            @Override
            public void callback(String result) {
                if(loginView != null){
                    loginView.onLoginResult(result);
                }
            }
        });
    }
    public void attachView(LoginView3 loginView3){
        if(loginView == null){
            this.loginView = loginView3;
        }
    }
    public void detachView(){
        if(loginView != null){
            this.loginView = null;
        }
    }
}
